home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-19 | 3.1 KB | 86 lines | [TEXT/ttxt] |
- Settings File = GEnie
- Script Name = Ask Date
- Command Key =
- F-Key =
- Menu = NO
- Button = NO
- Version = 3007
- System = Macintosh
-
- 1 Remark "Microphone II Script to ask user for date and check format is yymmdd"
- 2 Remark "Written by Melvyn D. Magree, (M)agreeable software, inc."
- 3 Remark ""
- 4 Remark "On entrance, StartEnd should be 'Start' or 'End' for type of date"
- 5 Remark "Returns date entered as GivenDate"
- 6 Remark "GivenDate is null string if user gives up on entering correct date format"
- 7 Remark ""
- 8 Remark "Latest update of this script - 91-04-18"
- 9 Remark ""
- 10 Set Variable * GivenDate from Expression "'*'"
- 11 Set Variable * CurrentDate from Expression "Mid(String(Year),3,2)&Mid(String(Month+100),2,2)&Mid(String(Day+100),2,2)"
- 12 Repeat
- 13 Set Variable * AskDate from Dialog Box "'Enter '&StartEnd&' Date in form YYMMDD'"
- 14 If Expression "AskDate=''"
- 15 Set Variable * GivenDate from Expression "AskDate"
- 16 Leave
- 17 Else If Expression "Length(AskDate)=6"
- 18 If Expression "AskDate>CurrentDate"
- 19 Alert * OK/Abort "'Date must be less than or equal today - '&CurrentDate"
- 20 If Success
- 21 Cycle
- 22 Else
- 23 Abort Script
- 24 End If
- 25 End If
- 26 Set Variable * StartYear from Expression "Number(Mid(AskDate,1,2))"
- 27 Set Variable * StartMonth from Expression "Number(Mid(AskDate,3,2))"
- 28 Set Variable * StartDay from Expression "Number(Mid(AskDate,5,2))"
- 29 Set Variable * DayRange from Expression "0"
- 30 If Expression "((1900+StartYear)<(Year-1)) or ((1900+StartYear)>Year)"
- 31 Alert * OK/Abort "'Year must be '&string(Year-1901)&' or '&string(Year-1900)"
- 32 If Failure
- 33 Abort Script
- 34 End If
- 35 Else If Expression "(StartMonth<1) or (StartMonth>12)"
- 36 Alert * OK/Abort "'Month must be 1 to 12'"
- 37 If Failure
- 38 Abort Script
- 39 End If
- 40 Else If Expression "(StartMonth=4) or (StartMonth=6) or (StartMonth=9) or (StartMonth=11) "
- 41 If Expression "(StartDay>0) and (StartDay<31)"
- 42 Set Variable * GivenDate from Expression "AskDate"
- 43 Else
- 44 Set Variable * DateRange from Expression "30"
- 45 End If
- 46 Else If Expression "StartMonth=2"
- 47 If Expression "(StartYear=0) or (StartYear Mod 4 <> 0)"
- 48 Set Variable * DaysInFeb from Expression "28"
- 49 Else
- 50 Set Variable * DaysInFeb from Expression "29"
- 51 End If
- 52 If Expression "(StartDay>0) and (StartDay<DaysInFeb)"
- 53 Set Variable * GivenDate from Expression "AskDate"
- 54 Else
- 55 Set Variable * DateRange from Expression "DaysInFeb"
- 56 End If
- 57 Else
- 58 If Expression "(StartDay>0) and (StartDay<32)"
- 59 Set Variable * GivenDate from Expression "AskDate"
- 60 Else
- 61 Set Variable * DayRange from Expression "31"
- 62 End If
- 63 End If
- 64 If Expression "DayRange>0"
- 65 Alert * OK/Abort "'Day must be 1 to '&string(DayRange)"
- 66 If Failure
- 67 Abort Script
- 68 End If
- 69 End If
- 70 Else
- 71 Alert * OK/Abort "'Enter date in form yymmdd. For example, 910322 for 22 March 1991.'"
- 72 If Failure
- 73 Abort Script
- 74 End If
- 75 End If
- 76 Until Expression "GivenDate<>'*'"
-